<?php

class Ext_Attachment_Music_Show
{
    public $musicId;
    public $attachmentMusicId;
    public $music;
    public $name;
    public $singer;
    public $title;
    public $description;
    
    public function __construct($attachmentMusicId)
    {
        $this->music = new Ext_Music_Show();
        $this->_build($attachmentMusicId);
    }
    
    private function _build($attachmentMusicId)
    {
        $this->attachmentMusicId = $attachmentMusicId;

        $music = App_Model_DbTable_Attachment_Music::getInstance()->getRowById($attachmentMusicId);
        if(isset($music['musicId'])){
            $this->musicId = $music['musicId'];
            $this->music->build($this->musicId);
        }

        if(isset($music['name'])){
            $this->name  = $music['name'];
        }
        if(isset($music['singer'])){
            $this->singer  = $music['singer'];
        }
        
        if($this->name != ''){
            $this->title = $this->name;
        }
        if($this->singer != ''){
            $this->title .= ' ['.$this->singer.']';
        }
        
        if(isset($music['description'])){
            $this->description = $music['description'];
        }
    }
}


